<template>
  <div>
    <button @click="dian">点</button>
    <van-field label="你好"/>
    <div id="main" style="width:500px;height:500px"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts';
import maxios from "@/http/axios";
export default {
  name: "txt1",
  data() {
    return {
      id : 2
    }
  },
  methods:{
    dian(){
      maxios('/text111?id='+this.id,'get').then(res=>{
        console.log(res)
      })
    },
    ech(){
      var chartDom = document.getElementById('main');
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [150, 230, 224, 218, 135, 147, 260],
            type: 'line'
          }
        ]
      };

      option && myChart.setOption(option);
    }
  },
  mounted() {
    this.ech()
  },

}
</script>

<style scoped>

</style>